<template>
  <el-dialog title="详情"
             :close-on-click-modal="false" append-to-body
             :visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll
             width="80%">
    <el-row :gutter="15" class="">
      <el-form ref="elForm" :model="dataForm" size="medium" label-width="100px" label-position="right">
        <template v-if="!loading">
          <el-col :span="24">
            <el-card class="mb-20" shadow="always" header="基本信息">
              <el-col :span="8">
                <el-form-item label="客户名称"
                              prop="customerName">
                  <p>{{ dataForm.customerName }}</p>
                </el-form-item>
              </el-col>
<!--              <el-col :span="8">-->
<!--                <el-form-item label="项目"-->
<!--                              prop="project">-->
<!--                  <p>{{ dataForm.project }}</p>-->
<!--                </el-form-item>-->
<!--              </el-col>-->
              <el-col :span="8">
                <el-form-item label="客户来源"
                              prop="customerSource">
                  <p>{{ dataForm.customerSource }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="客户类型"
                              prop="customerType">
                  <p>{{ dataForm.customerType | dynamicText(customerTypeOptions) }} </p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="客户性质"
                              prop="customerNature">
                  <p>{{ dataForm.customerNature | dynamicText(customerNatureOptions) }} </p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="客户所属行业"
                              prop="customersIndustry">
                  <p>{{ dataForm.customersIndustry | dynamicText(customersIndustryOptions) }} </p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="社会信用代码/身份证"
                              prop="customerCreditCode">
                  <p>{{ dataForm.customerCreditCode }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="详细地址"
                              prop="detailedAddress">
                  <p>{{ dataForm.detailedAddress }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="备注"
                              prop="notes">
                  <p>{{ dataForm.notes }}</p>
                </el-form-item>
              </el-col>
            </el-card>
          </el-col>
          <el-col :span="24">
            <el-card class="mb-20" shadow="always" header="联系人">
              <el-col :span="8">
                <el-form-item label="联系人"
                              prop="jnpf_zcgl_customer_user_jnpf_contacts">
                  <p>{{ dataForm.jnpf_zcgl_customer_user_jnpf_contacts }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="联系电话"
                              prop="jnpf_zcgl_customer_user_jnpf_contactNumber">
                  <p>{{ dataForm.jnpf_zcgl_customer_user_jnpf_contactNumber }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="邮箱"
                              prop="jnpf_zcgl_customer_user_jnpf_email">
                  <p>{{ dataForm.jnpf_zcgl_customer_user_jnpf_email }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="职位"
                              prop="jnpf_zcgl_customer_user_jnpf_position">
                  <p>{{ dataForm.jnpf_zcgl_customer_user_jnpf_position }}</p>
                </el-form-item>
              </el-col>
            </el-card>
          </el-col>
          <el-col :span="24">
            <el-card class="mb-20" shadow="always" header="工商信息">
              <el-col :span="8">
                <el-form-item label="法定代表人"
                              prop="jnpf_zcgl_customer_business_jnpf_legalRepresentative">
                  <p>{{ dataForm.jnpf_zcgl_customer_business_jnpf_legalRepresentative }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="注册资本"
                              prop="jnpf_zcgl_customer_business_jnpf_registeredCapital">
                  <p>{{ dataForm.jnpf_zcgl_customer_business_jnpf_registeredCapital }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="成立日期"
                              prop="jnpf_zcgl_customer_business_jnpf_establishmentDate">
                  <p>{{ jnpf.toDate(dataForm.jnpf_zcgl_customer_business_jnpf_establishmentDate, "yyyy-MM-dd") }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="经营状态"
                              prop="jnpf_zcgl_customer_business_jnpf_businessStatus">
                  <p>{{ dataForm.jnpf_zcgl_customer_business_jnpf_businessStatus }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="工商注册号"
                              prop="jnpf_zcgl_customer_business_jnpf_businessRegistrationNumber">
                  <p>{{ dataForm.jnpf_zcgl_customer_business_jnpf_businessRegistrationNumber }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="统一社会信用代码"
                              prop="jnpf_zcgl_customer_business_jnpf_creditCode">
                  <p>{{ dataForm.jnpf_zcgl_customer_business_jnpf_creditCode }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="组织机构代码"
                              prop="jnpf_zcgl_customer_business_jnpf_organizationCode">
                  <p>{{ dataForm.jnpf_zcgl_customer_business_jnpf_organizationCode }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="纳税人识别号"
                              prop="jnpf_zcgl_customer_business_jnpf_taxpayerNumber">
                  <p>{{ dataForm.jnpf_zcgl_customer_business_jnpf_taxpayerNumber }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="企业类型"
                              prop="jnpf_zcgl_customer_business_jnpf_enterpriseType">
                  <p>{{ dataForm.jnpf_zcgl_customer_business_jnpf_enterpriseType }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="营业期限开始时间"
                              prop="jnpf_zcgl_customer_business_jnpf_startTime">
                  <p>{{ jnpf.toDate(dataForm.jnpf_zcgl_customer_business_jnpf_startTime, "yyyy-MM-dd") }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="营业期限结束时间"
                              prop="jnpf_zcgl_customer_business_jnpf_endTime">
                  <p>{{ jnpf.toDate(dataForm.jnpf_zcgl_customer_business_jnpf_endTime, "yyyy-MM-dd") }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="行业"
                              prop="jnpf_zcgl_customer_business_jnpf_industry">
                  <p>{{ dataForm.jnpf_zcgl_customer_business_jnpf_industry }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="核准日期"
                              prop="jnpf_zcgl_customer_business_jnpf_approvalDate">
                  <p>{{ jnpf.toDate(dataForm.jnpf_zcgl_customer_business_jnpf_approvalDate, "yyyy-MM-dd") }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="实缴资本"
                              prop="jnpf_zcgl_customer_business_jnpf_paidCapital">
                  <p>{{ dataForm.jnpf_zcgl_customer_business_jnpf_paidCapital }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="人员规模"
                              prop="jnpf_zcgl_customer_business_jnpf_stafsize">
                  <p>{{ dataForm.jnpf_zcgl_customer_business_jnpf_stafsize }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="参保人数"
                              prop="jnpf_zcgl_customer_business_jnpf_individualsNumber">
                  <p>{{ dataForm.jnpf_zcgl_customer_business_jnpf_individualsNumber }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="登记机关"
                              prop="jnpf_zcgl_customer_business_jnpf_registrationAuthority">
                  <p>{{ dataForm.jnpf_zcgl_customer_business_jnpf_registrationAuthority }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="曾用名"
                              prop="jnpf_zcgl_customer_business_jnpf_formerName">
                  <p>{{ dataForm.jnpf_zcgl_customer_business_jnpf_formerName }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="英文名"
                              prop="jnpf_zcgl_customer_business_jnpf_englishName">
                  <p>{{ dataForm.jnpf_zcgl_customer_business_jnpf_englishName }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="注册地址"
                              prop="jnpf_zcgl_customer_business_jnpf_registeredAddress">
                  <p>{{ dataForm.jnpf_zcgl_customer_business_jnpf_registeredAddress }}</p>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="经营范围"
                              prop="jnpf_zcgl_customer_business_jnpf_businessScope">
                  <p>{{ dataForm.jnpf_zcgl_customer_business_jnpf_businessScope }}</p>
                </el-form-item>
              </el-col>
            </el-card>
          </el-col>
        </template>
      </el-form>
    </el-row>
    <span slot="footer" class="dialog-footer">
        <el-button @click="visible = false"> 取 消</el-button>
    </span>
  </el-dialog>
</template>
<script>
import request from '@/utils/request'
import PrintBrowse from '@/components/PrintBrowse'
import jnpf from '@/utils/jnpf'

export default {
  components: {PrintBrowse},
  props: [],
  data() {
    return {
      visible: false,
      loading: false,
      printBrowseVisible: false,
      printId: '',
      dataForm: {
        id: '',
        customerName: '',
        project: "",
        customerSource: "",
        customerType: '',
        customerNature: '',
        customersIndustry: "",
        customerCreditCode: '',
        detailedAddress: '',
        notes: '',
        zcgl_customer_business:
          {
            legalRepresentative: '',
            registeredCapital: '',
            establishmentDate: '',
            businessStatus: '',
            businessRegistrationNumber: '',
            creditCode: '',
            organizationCode: '',
            taxpayerNumber: '',
            enterpriseType: '',
            startTime: '',
            endTime: '',
            industry: '',
            approvalDate: '',
            paidCapital: '',
            stafsize: '',
            individualsNumber: '',
            registrationAuthority: '',
            formerName: '',
            englishName: '',
            registeredAddress: '',
            businessScope: '',
          },
        zcgl_customer_user:
          {
            contacts: '',
            contactNumber: '',
            email: '',
            position: '',
          },
        jnpf_zcgl_customer_user_jnpf_contacts: '',
        jnpf_zcgl_customer_user_jnpf_contactNumber: '',
        jnpf_zcgl_customer_user_jnpf_email: '',
        jnpf_zcgl_customer_user_jnpf_position: '',
        jnpf_zcgl_customer_business_jnpf_legalRepresentative: '',
        jnpf_zcgl_customer_business_jnpf_registeredCapital: '',
        jnpf_zcgl_customer_business_jnpf_establishmentDate: '',
        jnpf_zcgl_customer_business_jnpf_businessStatus: '',
        jnpf_zcgl_customer_business_jnpf_businessRegistrationNumber: '',
        jnpf_zcgl_customer_business_jnpf_creditCode: '',
        jnpf_zcgl_customer_business_jnpf_organizationCode: '',
        jnpf_zcgl_customer_business_jnpf_taxpayerNumber: '',
        jnpf_zcgl_customer_business_jnpf_enterpriseType: '',
        jnpf_zcgl_customer_business_jnpf_startTime: '',
        jnpf_zcgl_customer_business_jnpf_endTime: '',
        jnpf_zcgl_customer_business_jnpf_industry: '',
        jnpf_zcgl_customer_business_jnpf_approvalDate: '',
        jnpf_zcgl_customer_business_jnpf_paidCapital: '',
        jnpf_zcgl_customer_business_jnpf_stafsize: '',
        jnpf_zcgl_customer_business_jnpf_individualsNumber: '',
        jnpf_zcgl_customer_business_jnpf_registrationAuthority: '',
        jnpf_zcgl_customer_business_jnpf_formerName: '',
        jnpf_zcgl_customer_business_jnpf_englishName: '',
        jnpf_zcgl_customer_business_jnpf_registeredAddress: '',
        jnpf_zcgl_customer_business_jnpf_businessScope: '',
      },
      customerTypeOptions: [{"fullName": "办公", "id": "1"}, {"fullName": "商业", "id": "2"}],
      customerNatureOptions: [{"fullName": "企业", "id": "1"}, {"fullName": "个人", "id": "2"}],
      customersIndustryOptions: [{"fullName": "选项一", "id": "1"}, {"fullName": "选项二", "id": "2"}],

    }
  },
  computed: {},
  watch: {},
  created() {

  },
  mounted() {
  },
  methods: {
    dataInfo(dataAll) {
      let _dataAll = dataAll
      _dataAll.customerType = _dataAll.customerType ? JSON.parse(_dataAll.customerType) : []
      _dataAll.customerNature = _dataAll.customerNature ? JSON.parse(_dataAll.customerNature) : []
      _dataAll.customersIndustry = _dataAll.customersIndustry ? JSON.parse(_dataAll.customersIndustry) : []
      _dataAll.jnpf_zcgl_customer_user_jnpf_contacts = _dataAll.zcgl_customer_user.contacts
      _dataAll.jnpf_zcgl_customer_user_jnpf_contactNumber = _dataAll.zcgl_customer_user.contactNumber
      _dataAll.jnpf_zcgl_customer_user_jnpf_email = _dataAll.zcgl_customer_user.email
      _dataAll.jnpf_zcgl_customer_user_jnpf_position = _dataAll.zcgl_customer_user.position
      _dataAll.jnpf_zcgl_customer_business_jnpf_legalRepresentative = _dataAll.zcgl_customer_business.legalRepresentative
      _dataAll.jnpf_zcgl_customer_business_jnpf_registeredCapital = _dataAll.zcgl_customer_business.registeredCapital
      _dataAll.jnpf_zcgl_customer_business_jnpf_establishmentDate = _dataAll.zcgl_customer_business.establishmentDate
      _dataAll.jnpf_zcgl_customer_business_jnpf_businessStatus = _dataAll.zcgl_customer_business.businessStatus
      _dataAll.jnpf_zcgl_customer_business_jnpf_businessRegistrationNumber = _dataAll.zcgl_customer_business.businessRegistrationNumber
      _dataAll.jnpf_zcgl_customer_business_jnpf_creditCode = _dataAll.zcgl_customer_business.creditCode
      _dataAll.jnpf_zcgl_customer_business_jnpf_organizationCode = _dataAll.zcgl_customer_business.organizationCode
      _dataAll.jnpf_zcgl_customer_business_jnpf_taxpayerNumber = _dataAll.zcgl_customer_business.taxpayerNumber
      _dataAll.jnpf_zcgl_customer_business_jnpf_enterpriseType = _dataAll.zcgl_customer_business.enterpriseType
      _dataAll.jnpf_zcgl_customer_business_jnpf_startTime = _dataAll.zcgl_customer_business.startTime
      _dataAll.jnpf_zcgl_customer_business_jnpf_endTime = _dataAll.zcgl_customer_business.endTime
      _dataAll.jnpf_zcgl_customer_business_jnpf_industry = _dataAll.zcgl_customer_business.industry
      _dataAll.jnpf_zcgl_customer_business_jnpf_approvalDate = _dataAll.zcgl_customer_business.approvalDate
      _dataAll.jnpf_zcgl_customer_business_jnpf_paidCapital = _dataAll.zcgl_customer_business.paidCapital
      _dataAll.jnpf_zcgl_customer_business_jnpf_stafsize = _dataAll.zcgl_customer_business.stafsize
      _dataAll.jnpf_zcgl_customer_business_jnpf_individualsNumber = _dataAll.zcgl_customer_business.individualsNumber
      _dataAll.jnpf_zcgl_customer_business_jnpf_registrationAuthority = _dataAll.zcgl_customer_business.registrationAuthority
      _dataAll.jnpf_zcgl_customer_business_jnpf_formerName = _dataAll.zcgl_customer_business.formerName
      _dataAll.jnpf_zcgl_customer_business_jnpf_englishName = _dataAll.zcgl_customer_business.englishName
      _dataAll.jnpf_zcgl_customer_business_jnpf_registeredAddress = _dataAll.zcgl_customer_business.registeredAddress
      _dataAll.jnpf_zcgl_customer_business_jnpf_businessScope = _dataAll.zcgl_customer_business.businessScope
      this.dataForm = _dataAll
    },

    init(id) {
      this.dataForm.id = id || 0;
      this.visible = true;
      this.$nextTick(() => {
        if (this.dataForm.id) {
          this.loading = true
          request({
            url: '/api/example/ZcglCustomer/detail/' + this.dataForm.id,
            method: 'get'
          }).then(res => {
            this.dataInfo(res.data)
            this.loading = false
          })
        }

      })
    },
  },
}

</script>
